<script setup>
import { RouterView } from 'vue-router';
import { RouterLink } from 'vue-router';
//import router from './router'
import { useRouter } from 'vue-router';

const router = useRouter()

const toUsers = ()=>{
    router.push('/users/leveno')
}

const toUserDetail = ()=>{
    router.push({
        name:'userDetail',
        params:{
            id:1,
            username:'acy'
        },
        query:{
            limit:10,
            city:'北京'
        }
    })
}


</script>

<template>
    <div>
        <h1>hello vue-router</h1>
        <p>
            <RouterLink to="/" replace>首页</RouterLink>
            <RouterLink to="/home" replace>个人信息</RouterLink>
            <RouterLink to="/about" replace>系统信息</RouterLink>
            <RouterLink to="/users/acy" replace>用户信息</RouterLink>
            <button @click="toUsers">js跳转用户信息</button>
            <button @click="toUserDetail">用户明细信息</button>
            <RouterLink to="/video" replace>视频主页</RouterLink>
        </p>
        <!-- 可以根据路由动态切换的地方 -->
        <RouterView/>
    </div>
</template>

<style scoped>
</style>
